[core][flink][spark] Refactor global index building and support incremental refresh - #8818
[core][flink][spark] Refactor global index building and support incremental refresh#8818leaves12138 wants to merge 3 commits into
Conversation
86c6eb8 to
3c26b06
Compare
|
Older versions of the vector index are skipped by the refresh planner when |
|
The feature “automatically refresh the old vector index once after an upgrade” has not yet been implemented**. The old index lacks |
7922678 to
06f326e
Compare
06f326e to
4277d12
Compare
|
@JingsongLi Thanks for pointing this out. The previous wording was inconsistent with the implemented behavior. After discussion, automatic migration of indexes created before I also updated the title and description to cover the broader global-index build refactoring included here: |
Purpose
This PR has two related goals:
Previously, generic and sorted index builders mixed scan planning, mutable build state, and index-file writing. Incremental builds also considered only uncovered row ranges, so an index could remain readable but become stale after partial updates to indexed columns.
Global-index build refactoring
ScanResult, which carries the scan snapshot ID, selected row ranges, scan entries, and index entries to delete.GenericGlobalIndexScannerand remove the Flink-specificGenericGlobalIndexBuilder.SortedGlobalIndexScannerandSortedGlobalIndexWriterso scan state is returned explicitly instead of retained in mutable builder fields.GlobalIndexBuilderUtils.scanandincrementalScanflows.ScanResultand keep index writing separate from scan planning.Data-evolution index refresh
scanSnapshotIdinGlobalIndexMeta.sourceMeta, encoded with aDEIXmagic number and version.global-index.detect-datafile-change=true, select an existing index for refresh when an active data file:maxSequenceNumbergreater than the index'sscanSnapshotId.global-index.ignore-missing-delete=trueenables permissive behavior when explicitly required.Data-file change detection is disabled by default because it requires scanning manifest entries. Existing uncovered-range incremental builds retain their previous behavior unless the option is enabled.
Compatibility and scope
Indexes created before
DEIXsource metadata was introduced do not have a trustworthy scan watermark. This PR intentionally does not perform automatic migration or a one-time refresh for those indexes. They remain treated as covered and must be explicitly rebuilt once to populatesourceMetabefore participating in change-based refresh.User impact
For data-evolution tables with change detection enabled, users can continuously update indexed columns and run incremental index builds. Unaffected ranges remain available, while affected ranges are rebuilt and atomically replace their previous index files. Updates to unrelated physical columns do not trigger a refresh.
Tests